package com.shop.schedule;

import com.shop.mapper.InFormMapper;
import com.shop.model.dto.ScheduleLog;

import java.util.Date;

/**
 * @author : WanS
 * @date : 10:35 2020/11/24
 * scheduler 在什么时间做什么事 调度器
 * Trigger是Quartz的触发器，会去通知Scheduler何时去执行对应Job。
 */
public class MyScheduler {

    public static void insertLog(Date startTime, String error, Date endTime, int id, InFormMapper inFormMapper) {
        String msg = error == null ? "执行正常" : "error";
        String status = error == null ? "0" : "1";
        long interval = endTime.getTime() - startTime.getTime();
        inFormMapper.addScheduleLog(new ScheduleLog(id, startTime, endTime, interval, status, msg));
    }
}
